/*
* 阔地教育科技有限公司版权所有（codyy.com/codyy.cn）.
* Copyright (c) 2019, Codyy and/or its affiliates. All rights reserved.
* @Date: 2020.01.02 00:31.
* @Author
* @Description 浮动 - 导航栏组建
**/
<template>
    <div>
        <!-- logo -->
        <img class="h-logo" src="@/assets/img/logo-bg.jpg" style="margin:5px auto 20px auto !important;"/>
        <!-- 右侧 浮动 导航 -->
        <dl :key="item.title" class="h-float" v-for="item in list">
            <dt><p>{{ item.name }}</p> {{ item.type }}</dt>
            <dd :key="val.id" @click="handleRouterClick(val)" v-for="val in item.list">{{ val.name }}</dd>
        </dl>
    </div>
</template>
<script>
import { floatData } from '@/api'
//import { floatList } from '@/mock' // 导航数据

export default {
  name: 'NavBar',
  data () {
    return {
      list: []
    }
  },
  created () {
     this.getFloatData()
  },
  mounted () {
    //this.list = floatList.result
   // console.log(this.list)
  },
  methods: {
    /**
     *@Description
     *@Param
     *@Return .
     **/
    getFloatData () {
      const params = { // 请求参数 --- 根据情况 是否需要
        id: '111'
      }
      floatData(params).then(res => {
        this.list = res
      })
    },
    /**
     *@Description
     *@Param
     *@Return 点击跳转路由.
     **/
    handleRouterClick (item) {
     
      this.$router.push({ name: item.router, params: {type:item.type, id: item.id } })
    }
  }
}
</script>

<style lang="scss" scoped>
    .h-logo {
        display: block;
        width: 60px;
        height: 60px;
        margin: 5px auto 20px auto;
    }
    .h-float {
        font-size: 12px;
        width: 80px;
        margin-bottom: 10px;
        padding-top: 5px;
        text-align: center;
        color: #8F8F8F;
        border-top: 2px solid #000;
        &:hover {
            dd {
                display: block;
            }
        }
        dt {
            cursor: pointer;
        }
        p {
            font-size: 14px;
            color: #000;
        }
        dd {
            line-height: 25px;
            display: none;
            cursor: pointer;
            &:hover {
                text-decoration: underline;
            }
        }
    }
</style>
